package org.ace.controller;

import org.ace.model.Person;
import org.ace.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;
import java.util.Objects;

/**
 * Created by SunQiPeng on 2016/6/16.
 */
@Controller
public class TestController {

    @Autowired
    private PersonService personService;

    @RequestMapping("/index")
    public ModelAndView index(){
        return new ModelAndView("index");
    }

    @RequestMapping("/indexjson")
    @ResponseBody
    public Object json(){
        Person p = new Person();
        p.setName("hello");
        p.setPassword("world");
        return p;
    }

    @RequestMapping("/test")
    @ResponseBody
    public Object testTx(){
        personService.testTransactional();
        return "xxxx";
    }

}
